<?php
session_start();

$sql="SELECT eli.PartnerName,eli.Email,eli.Phone,eli.Website,eli.Logo, eli.Address,eli.BusinessNumber, eli.CorporateNumber FROM ac_eli_manager eli where eli.DatabaseName='elihan'";
$selectprofilecomp = mysql_query($sql);

$row = mysql_fetch_assoc($selectprofilecomp);
$compname = $row[PartnerName];
$corpnumber = $row[CorporateNumber];
$bussnumber = $row[BusinessNumber];
$address = $row[Address];
$phone = $row[Phone];
$email = $row[Email];
$website = $row[Website];
$logo = $row[Logo];


?>
<script type="text/javascript">
function checkvalidate(){
	var compname = document.getElementById("compname").value;
	if(compname.length==0){
		alert('You must input company name information!');
		return false;
	}
}
function updateProfileCompany(els){
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
	    {
		    //alert(xmlhttp.responseText);
	        document.getElementById("contentprocomp").innerHTML=xmlhttp.responseText;
	    }
	  }
	var lang = '<?=$_SESSION['lang']?>';
	xmlhttp.open("GET","admin/companyprofile/process-update-profile-company.php?newlang="+lang,true);
	xmlhttp.send();
}

</script>
<script type="text/javascript">
$(document).ready(function(){
<?php 
if (isset($_SESSION['alert'])){?>
	alert("Update successfuly!");
<?php unset($_SESSION['alert']);}
?>
});
</script>

<div id="contains" style="background-color: #edf4f7;">

	<div class="title"></div>
	<div class="body" id="contentprocomp">
		<div style="height: 10px;"></div>
		<div class="changeProfile">
			<span id="head"> <?php echo $l_compprofile?></span> <br />
			<div id="content">
				<div id="messPro"
					style="padding: 10px 0px 5px 0px; width: 400px; margin: auto; text-align: center; color: red">

				</div>
				<form
					action="admin/companyprofile/process-update-profile-company.php"
					method="get" onsubmit="return checkvalidate();">
					<table style="border-bottom: 1px dotted silver; width: 100%;">
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_company_name?> : *</td>
							<td style="width: 80%"><input id="compname" name="compname"
								type="text" class="textfiledProfile"
								value="<?php echo $compname;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_corponum?> :</td>
							<td><input id="corporate" name="corporate" type="text"
								class="textfiledProfile" value="<?php echo $corpnumber;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_bussinum?> :</td>
							<td><input id="business" name="business" type="text"
								class="textfiledProfile" value="<?php echo $bussnumber;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_address?> :</td>
							<td><input id="address" name="address" type="text"
								class="textfiledProfile" value="<?php echo $address;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_phone?> :</td>
							<td><input id="phone" name="phone" type="text"
								class="textfiledProfile" value="<?php echo $phone;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_email?> :</td>
							<td><input id="email" name="email" type="text"
								class="textfiledProfile" value="<?php echo $email;?>" /></td>
						</tr>
						<tr>
							<td width="200px" class="tdFirst"><?php echo $l_Website?> :</td>
							<td><input id="website" name="website" type="text"
								class="textfiledProfile" value="<?php echo $website;?>" /></td>
						</tr>
					</table>

					<div style="height: 10px;"></div>
					<div>
						<div style="float: left; color: red">(*)<?php echo $l_required?></div>
						<div style="float: right;">
							<input id="updateprofilecomp" name="updateprofilecomp"
								value="<?php echo $l_update?>" class="buttonNormal" type="submit" />
						</div>
					</div>
				</form>
				<div style="height: 20px;"></div>
			</div>
		</div>
		<div style="height: 20px;"></div>
		<div class="changePass">
			<span id="head"><?php echo $l_changelogo?> </span>
			<div id="content">
				<div style="padding-top: 10px; text-align: center;">
					<div class="picLogo" style="width: 100%">
					<?php
					if(isset($_POST['uploads']))
					{

						move_uploaded_file($_FILES['fileimg']['tmp_name'], "upload/".$_FILES['fileimg']['name']);
						$image =$_FILES['fileimg']['name'];
						$url = "upload/".$_FILES['fileimg']['name'];
						$sqlinsertlogo="update ac_eli_manager set Logo='$url' where DatabaseName='elihan'";
						mysql_query($sqlinsertlogo);
						?>

						<?php }?>
						<?php $sqllogo =mysql_query("SELECT eli.Logo FROM ac_eli_manager eli where eli.DatabaseName='elihan'");
						$r = mysql_fetch_assoc($sqllogo);
						?>
						<img src="<?php echo $r[Logo];?>" /><br />
					</div>
					<form action="#" method="post" enctype="multipart/form-data">
						<input type="file" name="fileimg" id="fileimg" size="40px" /> <input
							class="buttonNormal" type="submit" name="uploads" value="<?php echo $l_upload?>"
							style="width: 80px" />
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
